package cn.cheln.support.highlight;

import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;

public class TextHighLightDecorator extends Decorator
{
  public static final int decoratorType;
  private int highLightColor;
  private KeyMatcher matcher;

  public TextHighLightDecorator(int paramInt)
  {
    this.highLightColor = paramInt;
  }

  private boolean getHilite(SpannableStringBuilder paramSpannableStringBuilder, String paramString, int paramInt1, int paramInt2)
  {
    if (((paramInt1 == 0) && (paramInt2 == 0)) || (paramInt1 > paramInt2))
      return false;
    paramSpannableStringBuilder.setSpan(new ForegroundColorSpan(this.highLightColor), paramInt1, paramInt2, 33);
    this.matcher.matcherClean();
    return true;
  }

  public SpannableStringBuilder getDecorated(Object paramObject, String paramString1, String paramString2)
  {
    int j;
    String str1 = paramObject.toString();
    SpannableStringBuilder localSpannableStringBuilder = new SpannableStringBuilder(str1);
    this.matcher.match(str1, paramString1, true);
    if (getHilite(localSpannableStringBuilder, str1, this.matcher.getStart(), this.matcher.getEnd()));
    do
    {
      return localSpannableStringBuilder;
      this.matcher.matcherClean();
    }
    while (paramString2 == null);
    String[] arrayOfString1 = paramString2.trim().split("\\|");
    String[] arrayOfString2 = arrayOfString1[0].split("\\*");
    int i = arrayOfString1.length;
    String str2 = null;
    if (i > 1)
      str2 = arrayOfString1[1];
    if (arrayOfString2.length > 1)
      j = 1;
    while (true)
      try
      {
        int k = arrayOfString2.length;
        if (j >= k)
        {
          label132: this.matcher.matcherClean();
          KeyMatcher localKeyMatcher = this.matcher;
          if (str2 == null)
            break label263;
          label150: localKeyMatcher.match(str1, str2, true);
          if (!(getHilite(localSpannableStringBuilder, str1, this.matcher.getStart(), this.matcher.getEnd())));
          return new SpannableStringBuilder(str1);
        }
        if (this.matcher.match(arrayOfString2[j], false))
        {
          int l = str1.indexOf(arrayOfString2[(j + 1)]);
          boolean bool = getHilite(localSpannableStringBuilder, str1, l, l + 1);
          if (bool);
        }
        label263: ++j;
      }
      catch (Exception localException)
      {
        localException.printStackTrace();
        break label132:
        str2 = paramString2;
        break label150:
      }
  }

  public int getHighLightColor()
  {
    return this.highLightColor;
  }

  public KeyMatcher getMatcher()
  {
    return this.matcher;
  }

  public void setHighLightColor(int paramInt)
  {
    this.highLightColor = paramInt;
  }

  public void setMatcher(KeyMatcher paramKeyMatcher)
  {
    this.matcher = paramKeyMatcher;
  }

  public void setMatcher(String paramString)
  {
    this.matcher = new KeyMatcher(paramString);
  }
}

/* Location:           H:\360云盘\lewa_explorer_3.0\bin\FileApp_orig_dex2jar.jar
 * Qualified Name:     cn.cheln.support.highlight.TextHighLightDecorator
 * JD-Core Version:    0.5.2
 */